/**
 * 用于处理局内cookie
 * 考虑到部分项目所在服务器可能无法使用cookie，因此这里使用localStorage代替
 * 如果不考虑的话可以考虑使用 js-cookie 工具
 */
import { storageLocal } from "@pureadmin/utils";
import type { CookieAttributes } from "node_modules/@types/js-cookie";

const set = (name: string, value: any, _options?: CookieAttributes): any => {
  storageLocal().setItem(name, value);
};

const get = (name: string): any => {
  return storageLocal().getItem(name);
};

const remove = (name: string, _options?: CookieAttributes): void => {
  storageLocal().removeItem(name);
};

export default { set, get, remove };
